<div class="layuimini-container">
    <div class="layuimini-main">
        <fieldset id="searchFieldset_currentTable" class="table-search-fieldset layui-hide">
            <legend>{:lang("common.condition_search")}</legend>
            <form class="layui-form layui-form-pane form-search">
                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("role.name")}</label>
                    <div class="layui-input-inline">
                        <input name="r_name_like" class="layui-input" value="{$param.r_name_like|default=''}"
                               placeholder="{:lang('common.input')}{:lang('role.name')}">
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("role.type")}</label>
                    <div class="layui-input-inline">
                        <select name="r_type_eq" data-select-type="role_type"
                                default-value="{$param.r_type_eq|default=''}"
                                data-select-default="{:lang('common.choose')}">
                        </select>
                    </div>
                </div>

                <div class="layui-form-item layui-inline">
                    <label class="layui-form-label">{:lang("common.status")}</label>
                    <div class="layui-input-inline">
                        <select name="r_status_eq" default-value="{$ENABLE}"
                                data-select-type="status" data-select-default="{:lang('common.choose')}">
                        </select>
                    </div>
                </div>

                <div class="layui-form-item layui-inline" style="margin-left:50px">
                    <button type="submit" class="layui-btn layui-btn-normal" data-type="tableSearch"
                            lay-submit lay-filter="search_currentTable">{:lang("common.btn_search")}
                    </button>
                </div>
            </form>
        </fieldset>

        <table id="currentTable"
               data-auth-add="{:auth(request()->controller().'/add')}"
               data-auth-edit="{:auth(request()->controller().'/edit')}"
               data-auth-delete="{:auth(request()->controller().'/delete')}"
               data-auth-print="{:auth(request()->controller().'/print')}"
               data-auth-authorize="{:auth(request()->controller().'/authorize')}">
        </table>
    </div>
</div>
<script>
    layui.use(['myCommon'], function () {
        let myCommon = layui.myCommon;
        myCommon.table.render({
            where: myCommon.generateCondition()
            , limit: "{$param.limit|default='15'}"
            , cols: [[
                {type: "checkbox"}
                , {field: 'id', width: 60, title: '{:lang("common.id")}', sort: true}
                , {field: 'sort', width: 60, title: '{:lang("common.sort")}', sort: true}
                , {field: 'name', width: 120, title: '{:lang("role.name")}', sort: true}
                , {field: 'perms', minWidth: 80, title: '{:lang("role.perms")}'}
                , {
                    field: 'type',
                    width: 60,
                    title: '{:lang("role.type")}',
                    sort: true,
                    templet: myCommon.table.type,
                    typeList: 'role_type'
                }
                , {
                    field: 'status',
                    width: 60,
                    title: '{:lang("common.status")}',
                    sort: true,
                    templet: myCommon.table.type,
                    typeList: 'status'
                }
                , {field: 'update_time', width: 148, title: '{:lang("common.update_time")}', sort: true}
                , {
                    width: 140,
                    title: '{:lang("common.operate")}',
                    templet: myCommon.table.tool,
                    operat: [
                        'edit',
                        [{
                            text: '{:lang("role.authorize")}',
                            url: CONFIG.CONTROLLER + '/authorize',
                            method: 'open',
                            auth: 'authorize',
                            class: 'layui-btn layui-btn-normal layui-btn-xs',
                        }],
                        'delete'
                    ]
                }
            ]]
        });
        myCommon.listen();
    });
</script>
